home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / SCSI Samples 1.0 / SCSI DriveID Sample 06⁄07 ƒ / Src / ShowAllMountedVolumeNames.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  1.0 KB  |  50 lines  |  [TEXT/KAHL]

  1. /*                            ShowAllMountedVolumeNames.c                            */
  2. /*
  3.  * ShowAllMountedVolumeNames.c
  4.  * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved.
  5.  */
  6.  
  7. #include <stdio.h>
  8. #include <Files.h>
  9. #include <Devices.h>
  10. #ifndef FALSE
  11. #define FALSE        0
  12. #define TRUE        1
  13. #endif
  14.  
  15. void                    ShowAllMountedVolumeNames(void);
  16. void                    ShowSCSIDeviceIdent(
  17.         short                driverRefNum
  18.     );
  19.  
  20. void
  21. ShowAllMountedVolumeNames(void)
  22. {
  23.         short                    index;
  24.         OSErr                    status;
  25.         HVolumeParam            pb;
  26.         Str255                    volumeName;
  27.         
  28.         
  29.         for (status = noErr, index = 1;; index++) {
  30.             pb.ioCompletion = NULL;
  31.             pb.ioVolIndex = index;
  32.             volumeName[0] = 0;
  33.             pb.ioNamePtr = volumeName;
  34.             pb.ioVRefNum = 0;
  35.             status = PBHGetVInfo((HParmBlkPtr) &pb, FALSE);    /* Synchronous    */
  36.             if (status != noErr)
  37.                 break;
  38.             /*
  39.              * Display the drive number, driver number, and volume name.
  40.              */
  41.             printf("Drive %2d, driver %3d, \"%.*s\"",
  42.                 (int) pb.ioVDrvInfo,
  43.                 (int) pb.ioVDRefNum,
  44.                 volumeName[0], &volumeName[1]
  45.             );
  46.             ShowSCSIDeviceIdent(pb.ioVDRefNum);
  47.             printf("\n");
  48.         }
  49. }
  50.